/*
 * @Author: szx
 * @Date: 2022-02-28 16:04:55
 * @LastEditTime: 2022-02-28 16:08:44
 * @Description:
 * @FilePath: \leetcode\1-99\20\20_2.js
 */
/**
 * @param {string} s
 * @return {boolean}
 */
var isValid = function (s) {
    // 使用一个栈
    const st = [];
    for (let i of s) {
        if (i == '(') st.push(')');
        else if (i == '[') st.push(']');
        else if (i == '{') st.push('{');
        else if (st.length == 0 || st.pop() != i) return false;
    }
    return true;
};
